package com.wfm.read;

import org.apache.commons.lang3.StringUtils;
import org.springframework.batch.item.file.separator.SimpleRecordSeparatorPolicy;


public class BlankLineRecordSeparatorPolicy extends SimpleRecordSeparatorPolicy {
    public BlankLineRecordSeparatorPolicy(){}

    public boolean isEndOfRecord(String line) {
        return StringUtils.isNotBlank(StringUtils.trim(line))&&super.isEndOfRecord(line);
    }

    public String postProcess(String record) {
        return StringUtils.isBlank(StringUtils.trim(record))?null:super.postProcess(record);
    }

    public String preProcess(String line) {
        return line;
    }
}
